package com.hh.usersystem.action;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.hh.baseframework.util.base.BaseAction;
import com.hh.usersystem.bean.usersystem.HhXtJs;
import com.hh.usersystem.service.impl.RoleService;
import com.opensymphony.xwork2.ModelDriven;

@SuppressWarnings("serial")
public class Actionrole extends BaseAction implements ModelDriven<HhXtJs> {
	private HhXtJs hhXtJs = new HhXtJs();
	private String roles;
	@Autowired
	private RoleService roleService;

	public HhXtJs getModel() {
		return hhXtJs;
	}

	public void queryAllRoleList() {
		List<HhXtJs> hhxtjsList = roleService.queryAllRoleList();
		this.returnResult(hhxtjsList);
	}

	public void queryPagingData() {
		this.returnResult(roleService.queryPagingData(hhXtJs, roles, this.getPageRange()));
	}

	public void save() {
		// try {
		HhXtJs hhXtJs = roleService.save(this.hhXtJs);
		this.getResultMap().put("object", hhXtJs);
		// } catch (MessageException e) {
		// this.getResultMap().put("returnModel",
		// new ReturnModel(e.getMessage()));
		// }
		this.returnResult();
	}

	public void findObjectById() {
		HhXtJs hhXtJs = roleService.findObjectById(this.hhXtJs.getId());
		this.returnResult(hhXtJs);
	}

	public void deleteByIds() {
		roleService.deleteByIds(this.getIds());
	}

	public void insertOrdeleteMenu() {
		roleService.insertOrdeleteMenu(this.getParamsMap());
	}

	public void insertOrdeleteOperate() {
		roleService.insertOrdeleteOperate(this.getParamsMap());
	}
	
	public void updateOperateLevel() {
		roleService.updateOperateLevel(this.getParamsMap());
	}

	public String getRoles() {
		return roles;
	}

	public void setRoles(String roles) {
		this.roles = roles;
	}
	
}
